from ERP_system.utils.basemodels import BaseModel
from django.db import models


class Menu(BaseModel):
    number = models.IntegerField('排序数字', blank=True, null=True)
    url = models.CharField('菜单访问的URL', max_length=256, blank=True, null=True)
    delete_flag = models.CharField('是否删除', max_length=1, default='0')
    name = models.CharField('菜单名字', max_length=50)
    parent = models.ForeignKey('self', blank=True, null=True, related_name='children', on_delete=models.CASCADE)
    class Meta:
        db_table = 't_menu'
        verbose_name = '功能菜单'
        verbose_name_plural = verbose_name
        def __str__(self): return self.name
